<!DOCTYPE html>
<!-- ng-app -->
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../../../js/plugins/angular/angular.min.js" type="text/javascript"></script>
</head>
<body>
    <div ng-controller="cont">
        <div class="show">
            <input ng-model="a" value="0">
            <span>{{type}}</span>

            <input ng-model="b" value="0">
            <span>=</span>
            <span class="show">{{result}}</span>
        </div>
        <div class="show">
            <button ng-click="change(1)">加法</button>
            <button ng-click="change(0)">乘法</button>
        </div>
    </div>

    <script>
        var app = angular.module('app',[]);
        app.controller('cont',['$scope',function ($scope) {
            $scope.type = "+";
            $scope.change = function (t) {
                if(t){
                    $scope.type = "+";
                    $scope.result = parseInt($scope.a) +  parseInt($scope.b);
                }else{
                    $scope.type = "*";
                    $scope.result = $scope.a *  $scope.b;
                }
            }

        }])

    </script>
</body>
</html>